package cn.assumejson.springframework.aop.bean;

import cn.assumejson.springframework.beans.factory.annotation.Autowired;
import cn.assumejson.springframework.context.stereotype.Component;

import java.util.Random;

@Component
public class UserService {

    @Autowired
    private UserDao userDao;

    @Autowired
    private OrderService orderService;

    public String queryUserInfo() {
        try {
            Thread.sleep(new Random(1).nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "小刚刚，100001，成都;" + userDao.queryUserName("10003");
    }

    public String register(String userName) {
        try {
            Thread.sleep(new Random(1).nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "注册用户：" + userName + " success！";
    }

}
